<!--This is the small add-form used for Stock Manager's inline-editor -->
<!--It's just a form has 'action' attribute is actionAdd of Stock Controller -->
<?php
$url = Yii::app()->createUrl("stock/addStock");
$addForm = $this->beginWidget('CActiveForm', array(
    'id' => 'add-stock-form',
    'action' => $url,
    'enableAjaxValidation' => false,
));
?>
<table>
    <!-- Row's used for label. We echo the label here -->
    <tr class="add-row">
        <td><?php echo $addForm->labelEx($model, 'companyID'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'exchangeID'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'timestamp'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'open'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'close'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'high'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'low'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'ref'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'avg'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'ceiling'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'floor'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'volumeKhopLenh'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'volumeAgreement'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'valueKhopLenh'); ?></td>
        <td><?php echo $addForm->labelEx($model, 'valueAgreement'); ?></td>
    </tr>

    <!-- This is the row for all the input -->
    <tr class="add-row">
        <td><?php echo $addForm->dropDownList($model, 'companyID', $model->getAllCompany()); ?></td>
        <td><?php echo $addForm->dropDownList($model, 'exchangeID', $model->getAllExchanges()); ?></td>
        <td>
            <?php //Datepicker Widget used for Timestamp input
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'timestamp',
                // additional javascript options for the date picker plugin
                'options' => array(
                    'showAnim' => 'fold',
                    'dateFormat' => 'dd/mm/yy',
                    'changeMonth' => true,
                    'changeYear' => true,
                    'yearRange' => '-20:+20',
                ),
                'htmlOptions' => array(
                    'id' => 'add-datepicker'
                ),
            ));
            ?>
        </td>
        <td><?php echo $addForm->textField($model, 'open', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'close', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'high', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'low', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'ref', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'avg', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'ceiling', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'floor', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'volumeKhopLenh', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'volumeAgreement', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'valueKhopLenh', array('class' => 'numericOnly')); ?></td>
        <td><?php echo $addForm->textField($model, 'valueAgreement', array('class' => 'numericOnly')); ?></td>
    </tr>
</table>
<div class="buttons">
    <!--Save-->
    <?php echo CHtml::ajaxSubmitButton(
        'Save', $url,
        array('success' => 'function(data) { addProcessor(data); }'),
        array('class' => 'btSave')
    );?>

    <!--Cancel-->
    <?php echo CHtml::button('Cancel', array('id' => 'btCancel')); ?>
</div>
<?php $this->endWidget(); ?>
